**************************************************************
*                    The Face of the Party                   *
*Party Leadership Selection, and the Role of Family and Faith*
*                Vineeta Yadav & Amanda Fidalgo              *
*                      Replication File                      *
**************************************************************

/*

This do file replicates the analysis for all of the tables and figures 
located in the main paper and the suplemental appendix.

*/

*************************************************************************************************

** Set the working directory to the Replication flies folder
*e.g.  cd "C:\Users\aif08\Google Drive (afidalgo@ncf.edu)\Research\Turkey project\PRQ final"




use "TYK_elite.dta", clear



**Table A4 (appendix)
**Ordered Probit Models Using Categorical Responses for Democratic Party Leadership Elections

oprobit partyappoint Lreliga family_pol2
estat ic
oprobit partyappoint c.Lreliga##i.family_pol2
estat ic
oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
estat ic


**Figures 1a and 2a (main paper)
oprobit partyappoint c.Lreliga##i.family_pol2

label define family 0 "No Political Family" 1 "Political Family"
label value family_pol2 family

margins, dydx(Lreliga) predict(outcome(4)) at(family_pol2=(0(1)1))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))

margins, dydx(family_pol2) predict(outcome(4)) at(Lreliga=(-1.8(.1)1.8))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 



**Figure 1b and 2b (main paper)
oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
estat ic

margins, dydx(Lreliga) predict(outcome(4)) at(family_pol2=(0(1)1) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))


margins, dydx(family_pol2) predict(outcome(4)) at(Lreliga=(-1.8(.1)1.8) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 



**Table A5(appendix)
**Probit Models Using Dichotomous Responses for Democratic Party Leadership Elections

probit partyappointD Lreliga family_pol2
estat ic
probit partyappointD c.Lreliga##i.family_pol2
estat ic
probit partyappointD c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
estat ic


**Table A6(appendix)
**Missing data frequency by variable
misstable summarize partyappointD Lreliga family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed 


**Tabl A7(appendix)
**Frequency of Missing observations by Party
tab party if partyappointD==.
tab party if Lreliga==.
tab party if family_pol2==.
tab party if percap_vt_8d==.
tab party if inv_rank_std==.
tab party if officeexp==.
tab party if AKP==.
tab party if party_brand3==.
tab party if ed==.



**Table A8(appendix)
**t-tests (or proportions tests for dichotomous variables) comparing missing and non-missing observations
oprobit partyappoint c.Lreliga##i.family_pol2
predict mod1 if e(sample)
gen missingmod1=1 if mod1==.
replace missingmod1=0 if mod1!=.

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
predict mod2 if e(sample)
gen missingmod2=1 if mod2==.
replace missingmod2=0 if mod2!=.


ttest Lreliga, by(missingmod1)
ttest Lreliga, by(missingmod2)
prtest family_pol2, by(missingmod1)
prtest family_pol2, by(missingmod2)

ttest percap_vt_8d, by(missingmod2)
ttest inv_rank_std, by(missingmod2)
prtest officeexp, by(missingmod2)
ttest party_brand3, by(missingmod2)
ttest ed, by(missingmod2)
ttest rural12, by(missingmod2)





**Table A9(appendix)
**Selection model results for Missing Religiosity: Democratic Party Leadership Elections
heckoprobit partyappoint c.Lreliga i.family_pol2 ///
,select(ana_relig=b6.party )
estat ic

heckoprobit partyappoint c.Lreliga##i.family_pol2 ///
,select(ana_relig=b6.party )
estat ic

heckoprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12 ///
,select(ana_relig=b6.party )
estat ic


**Figure A3(appendix)
**Marginal Effects for Model 8 
heckoprobit partyappoint c.Lreliga##i.family_pol2 ///
,select(ana_relig=b6.party )
estat ic

*Figure A3.a
margins, dydx(family_pol2) predict(outcome(1)) at(Lreliga=(-1.8(.1)1.8))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 

*Figure A3.b
margins, dydx(family_pol2) predict(outcome(4)) at(Lreliga=(-1.8(.1)1.8))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 

*Figure A3.c
margins, dydx(Lreliga) predict(outcome(1)) at(family_pol2=(0(1)1))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))

*Figure A3.d
margins, dydx(Lreliga) predict(outcome(4)) at(family_pol2=(0(1)1))
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))





**Figure A3(appendix)
**Marginal Effects for Model 9
heckoprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12 ///
,select(ana_relig=b6.party )
estat ic

*Figure A3.a
margins, dydx(family_pol2) predict(outcome(1)) at(Lreliga=(-1.8(.1)1.8) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 

*Figure A3.b
margins, dydx(family_pol2) predict(outcome(4)) at(Lreliga=(-1.8(.1)1.8) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("Religiosity", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(line) recastci(rline) ciopts(lpattern(dash)) ylin(0, lpattern(shortdash)) ytick(-1(.5)1) ylabel(-1(.5)1) 

*Figure A3.c
margins, dydx(Lreliga) predict(outcome(1)) at(family_pol2=(0(1)1) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))

*Figure A3.d
margins, dydx(Lreliga) predict(outcome(4)) at(family_pol2=(0(1)1) ///
percap_vt_8d=1 inv_rank_std=.51 officeexp=0 AKP=0 party_brand3=.17 ed=2 rural12=.20)
marginsplot, graphregion(fcolor(white) ilcolor(white) lcolor(white)) ///
title("", size(large)) ///
xtitle("", size(medium)) ytitle("Change in the Predicted Probability", size(medium))  ///
recast(scatter) ylin(0, lpattern(shortdash)) ///
ytick(-1(.5)1) ylabel(-1(.5)1) xscale(r(-.25,1.25))




**TABLE A10(appendix)
**Additional Controls: Democratic Party Leadership Elections
oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12 HDP MHP
estat ic

oprobit partyappoint c.Lreligb##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
estat ic

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand ed rural12 
estat ic

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand2 ed rural12 
estat ic

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 intervention2 ed rural12 
estat ic

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 lawquran2  ed rural12 
estat ic

oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 pty_isl ed rural12 
estat ic



**TABLE A11(appendix)
**Controlling for Religious Party Membership Using Conditional Mixed Process Models: Democratic Party Leadership Elections
cmp setup

set more off
oprobit partyappoint c.Lreliga##i.family_pol2
predict pred1 if e(sample)
cmp  (pty_isl  = Lreliga isl_vote ed age)  ( partyappoint = c.Lreliga##i.family_pol2) if pred1!=., ind($cmp_probit $cmp_oprobit) tech(dfp) nonrtolerance
estat ic

set more off
oprobit partyappoint c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12
predict pred2 if e(sample)
cmp  (pty_isl  = Lreliga isl_vote ed age)  ( partyappoint = c.Lreliga##i.family_pol2 percap_vt_8d inv_rank_std officeexp AKP party_brand3 ed rural12) if pred2!=., ind($cmp_probit $cmp_oprobit) tech(dfp) nonrtolerance
estat ic



**Table A16(appendix)
**Elite Correlations for the religious beliefs and behaviors common to WVS, PEW & Elite Surveys

pwcorr relig29 relig25 polislam12 relig22, sig 




***************The following analysis uses data from the World Values Survey ******************
***************and the Pew Research Center's World Muslims Database*****************************

*Load the WVS data 
use "WVSEVS_Joint_v1-0-0.dta", clear

*Clean the WVS data 
recode A006 (1=4) (2=3) (3=2) (4=1), gen(religimp)
recode F028 (8=0) (7=1) (6=2) (5=3) (4=4) (3=5) (2=6) (1=7), gen(religatt)
recode F034 (2 3=0), gen(religperson)
recode F028B_WVS7 (8=0) (7=1) (6=2) (5=3) (4=4) (3=5) (2=6) (1=7), gen(prayer)
recode X001 (2=0), gen(male)
recode X028 (1 2 3=1) (4=2) (5=3) (6=4) (7 8=5), gen(employment)
recode X007 (1=1) (6=2) (2 3 4 5=3), gen(marital)
recode F025 (0=1) (1 2 3 8=2) (4=3) (5=4) (6=5) (7=6) (9=7), gen(relig)


**TABLE A13(appendix)
**Association Between Measures of Religiosity and Attendance at Religious Services Using Data From The World Values Survey (WVS)
reg religatt religimp prayer if cntry==792
estat ic
reg religatt religimp religperson prayer X003 male i.employment X025A_01 i.marital if cntry==792
estat ic
reg religatt religimp religperson prayer
estat ic
reg religatt religimp religperson prayer X003 male i.employment X025A_01 i.marital i.relig
estat ic





*Load the Pew data 
use "PewWMD2.dta", clear

*Clean the Pew data 
recode Q36 (5 6=.) (1=4) (2=3) (3=2) (4=1), gen(religimp)
recode Q67 (2=1) (1 3=0) (4 5=.), gen(sharia2)
label var sharia2 "the sharia should be open to multiple interpretations or there is only one, true understanding of the sharia?"
recode Q84d (2=1) (1 3 4=0) (5 6=.) ,gen(moral4)
recode Q61 (8 9=.) (7=0) (6=1) (5=2) (4=3) (3=4) (2=5) (1=6), gen(prayer)
label var prayer "Outside of attending religious services, do you pray several times a day"
recode Q95 (2=0), gen(male)
recode Q96 (80 81=.), gen(age)
recode Q97 (2 4=3) (5=2) (6 7=.), gen(marital)
replace marital=1 if Q97RUS==1
replace marital=2 if Q97RUS==5
replace marital=3 if Q97RUS==2 | Q97RUS==3 | Q97RUS==4 
replace marital=. if Q97RUS==6 | Q97RUS==7
label define marital 1 "Married" 2 "Single/never married" 3 "Other"
label value marital marital
recode Q101TUR (11=.), gen(edTUR)
recode Q133 (2=0), gen(urban)
recode Q34 (6=0) (5=1) (4=2) (3=3) (2=4) (1=5) (7 8=.), gen(mosque)





**TABLE A15(appendix)
**Association Between Measures of Religiosity and Attendance at Religious Using Data From The Pew Research Center’s World’s Muslim Data Set 
reg mosque religimp prayer sharia2 moral4  if COUNTRY==25
estat ic
reg mosque religimp prayer sharia2 moral4  age male i.marital urban edTUR if COUNTRY==25
estat ic
reg mosque  religimp prayer moral4   
estat ic
reg mosque  religimp prayer moral4 age male i.marital urban
estat ic

















